<?php
namespace Admin\Controller;
use Think\Controller;

class NewsController extends Controller {
	//列表页
	public function index(){
		$id = I('get.id');
		$product = M('Product');
		$map['status']=1;
		$map['price']=array('GT',100);
		$p = $product->field('o_product.product_id,o_product_description.name,o_product.price')->join('o_product_description on o_product_description.product_id=o_product.product_id')->where($map)->select();
		print_r($p);
	}
	//表单页
	public function form(){
		if(I('geit.id')>0){
			
		}
		$action = U('save');
		$this->assign('action',$action);
		$this->display();

		$product = array();
		$class = array();
		$images = array();
		$this->assign('product',$action);
		$this->assign('product',$action);
	}


	//保存页面，如果有ID就是修改记录，没有ID就是新增记录
	public function save(){
		$NewsModel = D('Setting');
		$data['code']='aaa';
		$data['key']='222';
		$data['value']='4';
		$data['serialized']=0;
		if($NewsModel->create($data)){
			$r = $NewsModel->add();
			if($r){
				echo 'ok';
			}else{
				echo 'error';
			}
		}else{
			echo $NewsModel->getError();
		}
	}
}